package com.example.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.system.entity.Care;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CareMapper extends BaseMapper<Care> {

    @Select("SELECT * FROM care WHERE user_id = #{userId}")
    List<Care> findCareByUserId(Integer userId);

    @Delete("DELETE FROM care WHERE care_id = #{careId}")
    int deleteCareByCareId(Integer careId);

    int addCareByCare(Care care);

    @Select("SELECT * FROM care WHERE care_id = #{careId};")
    Care findCareByCareID(Integer careId);

    @Update("UPDATE care SET score = #{score},appraise = #{appraise},finish = #{finish} WHERE care_id = #{careId};")
    Care updateCareByCareId(Integer careId);
}
